package com.hkemmm.control;

import com.hkemmm.bean.UserInfo;
import com.hkemmm.model.UserModel;
import com.hkemmm.utils.MyUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "UserInfoDeleteServlet", value = "/DeleteJump")
public class UserInfoDeleteServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String strID = request.getParameter("userID");

        //物理删除
        //int i = MyUtils.getInstence(UserModel.class).userDeleteByID(strID);

        //逻辑删除
        int i = MyUtils.getInstence(UserModel.class).userDeleteByID1(strID);

        //查询删除后所有数据
        List<UserInfo> lstUsers = MyUtils.getInstence(UserModel.class).queryUserInfoAll();
        //传回前端页面
        request.getSession().setAttribute("lstUsers",lstUsers);
        //页面跳转
        request.getRequestDispatcher("WEB-INF/viewpages/userInfoQueryDetail.jsp").forward(request,response);

    }
}
